<!--
  ~  Copyright (C) 2018 justlive1
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
  ~ in compliance with the License. You may obtain a copy of the License at
  ~
  ~ http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software distributed under the License
  ~ is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
  ~ or implied. See the License for the specific language governing permissions and limitations under
  ~ the License.
  -->
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <title>查找</title>
  <link href="/static/js/layui-v2.3.0/css/layui.css" rel="stylesheet">
  <link href="/static/css/him.css" rel="stylesheet">
</head>
<body>
<div style="margin: 15px;">
  <form class="layui-form">
    <div class="layui-form-item">

      <div class="layui-inline">
        <input type="text" name="keyword" id="keyword" placeholder="输入用户名或者昵称" autocomplete="off"
               class="layui-input">
      </div>

      <div class="layui-inline">
        <select id="type" lay-verify="" lay-filter="type">
          <option value="0" selected>好友</option>
          <option value="1">群组</option>
        </select>
      </div>

      <div class="layui-inline">
        <button class="layui-btn layui-btn-normal" id="find"><i class="layui-icon">&#xe615;</i>
          查找
        </button>
        <button class="layui-btn layui-btn-normal" id="add-group"><i class="layui-icon">&#xe608;</i>新建群组
        </button>
      </div>
    </div>
  </form>

  <div id="find-result-view"></div>
  <div class="lay-page" id="page-view"></div>
</div>

<script type="text/html" id="find-view-tpl">
  <fieldset class="layui-elem-field layui-field-title">
    <legend>{{ d.legend}}</legend>
  </fieldset>
  <div class="layui-row">
    {{# if(d.type == '0'){ }}
    {{# layui.each(d.data, function(index, item){ }}
    <div class="layui-col-xs3 layui-find-list">
      <li layim-event="add">
        <img src="{{ item.avatar }}">
        <span>{{item.username}}</span>
        <p> {{# if(item.sign == null){ }}这个人很懒，什么都没留下。{{# }else{ }}{{item.sign}} {{# } }} </p>
        <button class="layui-btn layui-btn-xs btncolor add" data-type="0"
                data-avatar="{{item.avatar }}" data-uid="{{item.id}}" data-name="{{item.username}}">
          <i class="layui-icon">&#xe654;</i>加好友
        </button>
      </li>
    </div>
    {{# }); }}
    {{# }else{ }}
    {{# layui.each(d.data, function(index, item){ }}
    <div class="layui-col-xs3 layui-find-list">
      <li layim-event="add">
        <img src="{{ item.avatar }}">
        <span>{{item.groupname}}({{item.id}})</span>
        <p> {{# if(item.des == null){ }}暂无群介绍{{# }else{ }}{{item.des}} {{# } }} </p>
        <button class="layui-btn layui-btn-xs btncolor add" data-type="1"
                data-avatar="{{item.avatar}}" data-uid="{{item.id}}" data-name="{{item.groupname}}">
          <i class="layui-icon">&#xe654;</i>加群
        </button>
      </li>
    </div>
    {{# }); }}
    {{# } }}
  </div>
</script>
<script type="text/javascript" src="/static/js/layui-v2.3.0/layui.js"></script>
<script type="text/javascript" src="/static/js/syslib/find.js"></script>
</body>
</html>
